import Vue from 'vue'
import Vuex from 'vuex'

Vue.use(Vuex)
const store = new Vuex.Store({
	state: {
		user: {
			id: 0,
			nickName: "",
			imgUrl: "",
			description: "",
			phone: "",
			realName: "",
			college: "",
			className: ""

		},
		star: 0,
		touch: 0
	},
	mutations: {
		setInfo(state, provider) {
			state.user = provider.user;
			state.touch = provider.touch;
			state.star = provider.star;
		},
		out(state) {
			state.user = {};
			state.touch = 0;
			state.star=0;
		},
		setNickName(state, provider) {
			state.user.nickName = provider.nickName;
		},
		setDescription(state, provider) {
			state.user.description = provider.description;
		},
		setImgUrl(state, provider) {
			state.user.imgUrl = provider.imgUrl;
		},
		setPhone(state, provider) {
			state.user.phone = provider.phone;
		},
		setStar(state, provider) {
			state.star = provider.star;
		},
		setTouch(state, provider) {
			state.touch = provider.touch;
		}
	}
})

export default store
